package com.jindun.paper.ui.handler;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.ui.PlatformUI;

import com.jindun.paper.ui.client.ClientEditorDialog;
import com.jindun.paper.ui.client.ClientListView;
import com.jindun.paper.ui.clienttype.ClientTypeEditorDialog;
import com.jindun.paper.ui.clienttype.ClientTypeListView;

public class ClientTypeAddHandler extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {

		ClientTypeEditorDialog dialog = new ClientTypeEditorDialog(PlatformUI
				.getWorkbench().getActiveWorkbenchWindow(), null);
		
		
		if (dialog.open() == Dialog.OK) {
			ClientTypeListView clientListView = (ClientTypeListView) PlatformUI
					.getWorkbench().getActiveWorkbenchWindow().getActivePage()
					.findView("clientTypeListView");
			clientListView.refresh();
		}

		return null;
	}

}
